Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
Mac and OpenDoc are trademarks of Apple Computer, Inc.
Creating a part of a particular kind
OpenDoc provides the user many ways of embedding new content including drag & drop, and copy & paste.
One traditional mechanism which applications have used to create new embedded content is a palette with a variety of kinds of content such as text, drawing, painting etc. If your container part editor supports such a palette, then when the user chooses one of those abovementioned kinds of content and performs a gesture in your content area, you need to create a new part of the kind which the user has chosen. This is a brief recipe showing the specific calls you need to make to do this.
Overview
There are are two thing your part editor needs to know how to do in order to properly implement this recipe.
1. How to check to see if an editor is installed which will support a specific kind (so that your editor can know to dim the palette item or enable it). The method EditorIsAvailableForKind provides this information.
2. How to create a new part of a particular kind. The method CreatePartOfKind performs this function.
Caveats
• This code does not contain proper error checking.
• This code assumes your part editor stores a reference to the session object in the field fSession.
• This code assumes your part editor stores a reference to its partwrapper object in the field fSelf as documented in the "Part Init & Externalizing" recipe document.